﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RealState.BLL;
using log4net;

namespace RealState.W
{
    public partial class MyContents : System.Web.UI.Page
    {
        private VwContentsBLL contentsBLL;
        protected ILog log = LogManager.GetLogger("MyContents");
        private static string userid = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            userid = Convert.ToString(Session["CustomerID"]);
            if (!Page.IsPostBack)
            {
                LoadContent(userid);
            }
        }
        public void LoadContent(string userid)
        {
            contentsBLL = new VwContentsBLL();
            try
            {
                Repeater1.DataSource = contentsBLL.GetViewContents().Where(v => v.UserID == Convert.ToInt32(userid)).OrderByDescending(v=>v.CreatedTime).ToList();
                Repeater1.DataBind();
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
            }
            finally
            {
                contentsBLL = null;
            }
        }
    }
}
